<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<title></title>
		<link rel="stylesheet" type="text/css" href="../../jquery-easyui-1.5.2/themes/default/easyui.css">
		<link rel="stylesheet" type="text/css" href="../../jquery-easyui-1.5.2/themes/icon.css">
		<link rel="stylesheet" type="text/css" href="../../jquery-easyui-1.5.2/demo.css">
		<link rel="stylesheet" type="text/css" href="../../style/syExtIcon.css">

		<script type="text/javascript" src="../../jquery-easyui-1.5.2/jquery.min.js"></script>
		<script type="text/javascript" src="../../jquery-easyui-1.5.2/jquery.easyui.min.js"></script>
		<script type="text/javascript" src="../../js/syExtEasyUI.js"></script>
		<script type="text/javascript" src="../../js/syExtHighcharts.js"></script>
		<script type="text/javascript" src="../../js/syExtJavascript.js"></script>
		<script type="text/javascript" src="../../js/syExtJquery.js"></script>
		<script type="text/javascript">
			function createRows() {
				parent.createRows($("#form"), $("#tablePrice"));
			}
			var getFormInfo = function() {
				return sy.serializeObject($("#form"));
			}
			var getPriceInfo = function() {
				var t=$("#tablePrice");
				var rows=t.datagrid("getRows");
				for (var i in rows) {
					t.datagrid('updateRow', {
								index: i,
								row: {}
							});
							t.datagrid("endEdit", i);
				}
				rows=t.datagrid("getRows");
				return rows;
			}

			function editrow(row, index) {
				$('#tablePrice').datagrid('beginEdit', index);
			}

			function saverow(row, index) {
				$('#tablePrice').datagrid('updateRow', {
					index: index,
					row: {}
				});
				$('#tablePrice').datagrid("endEdit", index);
			}

			function loadInfo(data) {
				$("#form").form("load", {
					"startTimeLabel": data.startTimeLabel,
					"endTimeLabel": data.endTimeLabel,
					"startStepTime": data.startStepTime,
					"startStepPrice": data.startStepPrice,
					"maxPrice": data.maxPrice,
					"unitDuration": data.unitDuration,
					"unitPrice": data.unitPrice,
					"crossDayUnitDuration": data.crossDayUnitDuration,
					"crossDayPrice": data.crossDayPrice,
				});
				if(data.tempObject != null) {
					$("#tablePrice").datagrid({
						data: data.tempObject
					})
				}
			}

			$(function() {
				var t = $("#tablePrice").datagrid({
					singleSelect: true,
					striped: true,
					rownumbers: true,
					columns: [
						[{
								width: "100",
								field: 'price0',
								title: "停车时长",
							},
							{
								width: "100",
								field: 'price1',
								title: "收费金额",
							},
							{
								width: "100",
								field: 'price2',
								title: "时段时长",
							},
							{
								width: "100",
								field: 'price3',
								title: "收费金额",
								editor: {
									type: 'numberbox',
									options: {
										min: 0,
										precision: 1
									}
								}
							},
						]
					],
					toolbar: '#main',
					onDblClickCell: function(index, field, row) {
						if(field == "price3") {
							t.datagrid("beginEdit", index);
						} else {
							t.datagrid('updateRow', {
								index: index,
								row: {}
							});
							t.datagrid("endEdit", index);
						}
					},
				})
				var title=sy.getUrlParam("title");
				var split=title.split("-");
				$("#form").form("load",{
					"startTimeLabel":split[0],
					"endTimeLabel":split[1]
				})
				parent.inifDurationsInfo($("#form"),$("#tablePrice"));
				
			});
		</script>
		<style>
			.dform {}
		</style>
	</head>

	<body>
		<div id="main">
			<form id="form" method="post">
				<table style="display: none;">
					<tr>
						<td><input name="startTimeLabel" value="00:00" /> </td>
						<td><input name="endTimeLabel" value="00:00" /></td>
					</tr>
				</table>
				<table>
					<tr>
						<td>起步时长</td>
						<td><input name="startStepTime" class="easyui-numberbox" data-options="required:true" style="width: 60px;" value="60" /> </td>
						<td>起步金额</td>
						<td><input name="startStepPrice" class="easyui-numberbox" data-options="required:true" style="width: 60px;" value="1" /></td>
						<td>时段最大收费</td>
						<td><input name="maxPrice" class="easyui-numberbox" data-options="required:true" style="width: 60px;" value="0" /></td>
						<td></td>
						<td></td>
						<td></td>
					</tr>
					<tr>
						<td>单位时长</td>
						<td><input name="unitDuration" class="easyui-numberbox" data-options="required:true" style="width: 60px;" value="60" /></td>
						<td>单位金额</td>
						<td><input name="unitPrice" class="easyui-numberbox" data-options="required:true" style="width: 60px;" value="1" /></td>
						<td>跨天单位时长</td>
						<td><input name="crossDayUnitDuration" class="easyui-numberbox" data-options="required:true" style="width: 60px;" value="0" /></td>
						<td>跨天单位金额</td>
						<td><input name="crossDayPrice" class="easyui-numberbox" data-options="required:true" style="width: 60px;" value="0" /></td>
						<td>
							<a class="easyui-linkbutton" href="javascript:void(0)" onclick="createRows();">生成</a>
						</td>
					</tr>
				</table>
			</form>
		</div>
		<table id="tablePrice" data-options="fit:true,border:false">

		</table>
	</body>

</html>